#!/bin/sh

user=root
passwd=root


#先备份
backname=~/`date +%Y%m%d%H%M`.sql
mysqldump -u${user} -p${passwd} student > ${backname}

#自动化构建恢复用
mysqldump -u${user} -p${passwd} student > ~/tmp.sql

mysql -u${user} -p${passwd} << EOF
drop database if exists student;
source init.sql;
source init-menu.sql;
source init-dictionary.sql;
EOF